#include "charWarrior.h"

charWarrior::charWarrior(pole*** tab):character::character('w')
{
    character::pToBoard=tab;
    Checked=false;
    Life=8;
    Rage=20;



}
//***************************************************
charWarrior::charWarrior(): character::character('w')
{
    Checked=false;
}
charWarrior::charWarrior(pole*** tab,int flag):character::character('w')
{
    character::pToBoard=tab;
    Checked=false;
    Life=8;
    Rage=20;
    loadGraphica("Grafika/p2.bmp","Grafika/bufor.bmp","Grafika/WariorFace.bmp");
}

//***************************************************
charWarrior::~charWarrior()
{
    SDL_FreeSurface(buffor);
}
//***************************************************
int charWarrior::SpecialPower(SDL_Event& event,SDL_Surface* screen){
    if(Rage>=2){
        if( event.type == SDL_MOUSEBUTTONDOWN ){
            if( event.button.button == SDL_BUTTON_RIGHT ){
                SDL_GetMouseState(&mouseXstart,&mouseYstart);
                mouseXstate=mouseXstart;
                mouseYstate=mouseYstart;
                Checked=true;

            }
        }

        if(event.type == SDL_MOUSEBUTTONUP)
        {
            if( event.button.button == SDL_BUTTON_RIGHT )
            {
                SDL_BlitSurface(buffor,NULL,screen,NULL);
                SDL_GetMouseState(&mouseXend,&mouseYend);
                Checked=false;
                if(abs((mouseXstart-mouseXend))>POLE_SIZE_PX &&abs((mouseYstart-mouseYend))>POLE_SIZE_PX )
                {
                    Rage-=2;


                }

                    return 3;
            }
                else
                    return 0;
      }


        }

        if(Checked)
        {
            if(event.type==SDL_MOUSEMOTION)
            {
                SDL_BlitSurface(buffor,NULL,screen,NULL);
                SDL_GetMouseState(&mouseXstate,&mouseYstate);
                boxRGBA(screen,mouseXstart,mouseYstart,mouseXstate,mouseYstate,0,0,128,100);

            }



        }



return 0;
}
